<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<s:url value="/css/style.css"/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery.form.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery.validate.js"/>"></script>
<style type="text/css">
 .backcolor {
 	background: <s:property value="color" />;
 }
</style>
<script type="text/javascript">
var oldName = '<s:property value="name"/>';
function doSubmit(){
	if(window.confirm('Save modify?')) {
		var isSame = isSameAsExsited($('#name').val(),'<s:url value="/data/ClassLevel/same" />');
		 
		if(!isSame||oldName==$('#name').val()){
		$('#editForm').submit();
		}else {
			var str = 'Please fix this field.';
			$('#xxx').html(str).addClass('error').show(); 
			 
		}
	}
}
function goBack(){
	location.href='<s:url value="/data/ClassLevel/list"/>';
}
$(function(){
	$('#editForm').validate();
	$('#xxx').hide();
	if($.trim($('#result').text())!=''){
		popupDiv('pop-div');
	}
});
function colorpick(field){ 

	var rtn=window.showModalDialog('<s:url value="/common/color.jsp" />',"x","dialogWidth:262px;dialogHeight:180px;status:no;help:no;scrolling=no;scrollbars=no"); 
	if(rtn!=null){ 
	field.style.background=rtn; 
	field.value=rtn;
	return; 
	} 


	} 

</script>
<title><s:text name="system.title" /></title>
</head>
<body>
<s:include value="/common/up.jsp"></s:include>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td class="box">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td id="tag-over"><span id="tag-over">Class Level</span></td>
				<td class="tab3-line" width="90%">&nbsp;</td>
			</tr>
		</table>
		<s:form  action="ClassLevel/save" namespace="/data" method="post" id="editForm" name="editForm">
		<s:hidden name="id"></s:hidden>
		<table width="100%" border="0" cellpadding="3" cellspacing="1" class="margin">
			<tr>
				<td align="right" width="50%" class="tablecolour5">Name<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="name" id="name" cssClass="input2 required " size="24" /><label id="xxx"></label></td>
			</tr>
			<tr>
				<td align="right" class="tablecolour5">Color<font color="red">*</font>:</td>
				<td class="tablecolour5">
				<s:textfield name="color"   cssClass="input2 backcolor" size="24" onclick="colorpick(this)"  />
				</td>
			</tr>
			<tr>
				<td align="right" class="tablecolour5">Category<font color="red">*</font>:</td>
				<td class="tablecolour5"><s:select name="category" listKey="name()" list="@com.ef.constant.EClassLevel@values()" /></td>
			</tr>
			<tr>
				<td align="right" class="tablecolour5">Description:</td>
				<td class="tablecolour5" ><s:textfield name="description" cssClass="input2" size="50" /></td>
			</tr>
		<tr>
			<td align="center" colspan="2" height="50" class="tablecolour5">
			<input name="reset" type="reset" class="btn1" value="Reset" />
			<input type="button" class="btn1" value="Save"  onclick="doSubmit();"  /> 
			<input name="goback" type="button" class="btn1"
				value="Go Back" onclick="goBack()" /></td>
		</tr>
		</table>
		</s:form>
		</td>
	</tr>
</table>
<s:include value="/common/down.jsp"></s:include>
<div id='pop-div' style="width: 300px;" class="pop-box">  
  <s:include value="/common/confirm.jsp"></s:include>   
</div>

</body>
</html>